package com.tf8.treasure.enums;

import org.apache.commons.lang3.StringUtils;

public enum UserLevel {
    Level_1("1","高富帅"),
    Level_2("2","白金vip"),

    ;
    String code;
    String name;
    UserLevel(String code,String name){
        this.code=code;
        this.name=name;
    }

    public static UserLevel getByCode(String code) {
        if (StringUtils.isBlank(code)) return null;
        UserLevel[] userLevels = UserLevel.values();
        for (UserLevel userLevel : userLevels) {
            if (code.trim().equals(userLevel.getCode())) {
                return userLevel;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
